package com.julian.warehouse.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2018/8/8.
 */

public class MyDBOpenHelper extends SQLiteOpenHelper{


    private static String name = "mydb.db"; //表示数据库的名称
    //private static int version = 1; //表示数据库的版本号
    private static int version = 2; //更新数据库的版本号，此时会执行 onUpgrade()方法
    public MyDBOpenHelper(Context context) {
        super(context, name, null, version);
        // TODO Auto-generated constructor stub
    }


    @Override
    public void onCreate(SQLiteDatabase db) {

        //产品表（主表）
        String sql = GoodsTable.getCreatGoodsTableSQL();
        db.execSQL(sql);

        //出入库记录表
        String sql2 = RecordsTable.getCreatRecordsTableSQL();
        db.execSQL(sql2);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
